<?php

declare(strict_types=1);

use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler;

$logFileBasePath = BASE_PATH . '/runtime/logs';

return [
    'default' => [
        'handler' => [
            'class' => RotatingFileHandler::class,
            'constructor' => [
                'level' => Monolog\Logger::DEBUG,
                'filename' => $logFileBasePath . '/service.log',
                'dateFormat' => 'ymd'
            ]
        ],
        'formatter' => [
            'class' => LineFormatter::class,
            'constructor' => [
                'format' => null,
                'dateFormat' => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true,
            ],
        ],
    ],

    'http-apis' => [
        'handlers' => [
            [
                'class' => RotatingFileHandler::class,
                'constructor' => [
                    'level' => Monolog\Logger::DEBUG,
                    'filename' => $logFileBasePath . '/apis/.log',
                    'dateFormat' => 'ymd'
                ]
            ],
        ],
        'formatter' => [
            'class' => LineFormatter::class,
            'constructor' => [
                'format' => null,
                'dateFormat' => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true,
            ],
        ],
    ],

    'http-back' => [
        'handler' => [
            'class' => RotatingFileHandler::class,
            'constructor' => [
                'level' => Monolog\Logger::DEBUG,
                'filename' => $logFileBasePath . '/back/' . '.log',
                'dateFormat' => 'ymd'
            ],
        ],
        'formatter' => [
            'class' => LineFormatter::class,
            'constructor' => [
                'format' => null,
                'dateFormat' => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true,
            ],
        ],
    ],

    'task' => [
        'handler' => [
            'class' => RotatingFileHandler::class,
            'constructor' => [
                'level' => Monolog\Logger::DEBUG,
                'filename' => $logFileBasePath . '/task.log',
                'dateFormat' => 'ym'
            ]
        ],
        'formatter' => [
            'class' => LineFormatter::class,
            'constructor' => [
                'format' => null,
                'dateFormat' => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true,
            ],
        ],
    ],

    'pay' => [
        'handler' => [
            'class' => RotatingFileHandler::class,
            'constructor' => [
                'level' => Monolog\Logger::INFO,
                'filename' => $logFileBasePath . '/pay/.log',
                'dateFormat' => 'ymd'
            ]
        ],
        'formatter' => [
            'class' => LineFormatter::class,
            'constructor' => [
                'format' => null,
                'dateFormat' => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true,
            ],
        ],
    ],


    'sql' => [
        'handler' => [
            'class' => RotatingFileHandler::class,
            'constructor' => [
                'level' => Monolog\Logger::INFO,
                'filename' => $logFileBasePath . '/sql' . '.log',
                'dateFormat' => 'ymd'
            ]
        ],
        'formatter' => [
            'class' => LineFormatter::class,
            'constructor' => [
                'format' => "[%datetime%] %level_name%: %message% \n",
                'dateFormat' => 'Y-m-d H:i:s',
                'allowInlineLineBreaks' => true,
            ],
        ],
    ],

];
